Strict

Import agfx

Global myGameScreen:TGameScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		Super.OnCreate()
			
		SOUNDS.Load("lazer")
		SOUNDS.Load("boom3")
		
		myGameScreen = New TGameScreen		
		myGameScreen.Prepare()
		
		Return 0
	End
	
End

Class TGameScreen Extends TScreen
	Field boom:TSound
	Field lazer:TSound
	
	Method New()

		name = "Game"
		boom = SOUNDS.Find("boom3")
		lazer = SOUNDS.Find("lazer")
	End

	Method Start:Void()
		
		APP.fadeScreen.Start(50, False)
	End
	
	Method Render:Void()
		Cls
		DrawText "GAME SCREEN!", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT , 0.5, 0.5
		DrawText "Press 1 for Boom Sound", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT + 20, 0.5, 0.5
		DrawText "Press 2 for Lazer Sound", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT + 40, 0.5, 0.5
		DrawText "Channel : "+SFX.channel, DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT + 60, 0.5, 0.5
	End

	Method Update:Void()
	
	
		If MOUSE.Hit(0)
			boom.Play()
		End
		
		If MOUSE.Hit(0)
			lazer.Play()
		End

		If KeyHit(KEY_ESCAPE)
			APP.fadeScreen.Start(50, True)
			APP.nextScreen = APP.exitScreen
		End
	End
End

